﻿<UserControl x:Class="MContracts.Controls.FilterContracts"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework"                      
             xmlns:controls="clr-namespace:MContracts.Controls"
             xmlns:contrconverters="clr-namespace:MContracts.Controls.Converters"
             xmlns:converters="clr-namespace:MContracts.Classes.Converters"
             mc:Ignorable="d" 
             xmlns:sys="clr-namespace:System;assembly=mscorlib" 
             xmlns:Filtering="clr-namespace:MContracts.Classes.Filtering"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
             d:DesignHeight="80" d:DesignWidth="386" DataContextChanged="UserControl_DataContextChanged">
    
    <UserControl.Resources>
        <Style TargetType="Button" x:Key="ActionButtonStyle">
            <Setter Property="Margin" Value="1"/>
            <Setter Property="Width" Value="18"/>
            <Setter Property="Height" Value="18"/>
        </Style>

        <contrconverters:PropertyToRussianConverter x:Key="PropertyToRussianConverter"/>
        <contrconverters:FilterConditionConverter x:Key="FilterConditionConverter"/>
        <contrconverters:SelectedPropertyConverter x:Key="SelectedPropertyConverter"/>
        
        <DataTemplate x:Key="PropertyDataTemplate">
            <TextBlock Text="{Binding Converter={StaticResource SelectedPropertyConverter}}"/>
        </DataTemplate>

    </UserControl.Resources>
    
    
        <StackPanel Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <Label Content="Год" />
                <TextBox x:Name="txtYear" Text="{Binding Year, UpdateSourceTrigger=LostFocus}" Width="100" Height="19" />
                <StackPanel Orientation="Horizontal">
                    <Button Style="{StaticResource ActionButtonStyle}" x:Name="Add" Command="{Binding AddCommand}">
                        <Image Source="/MContracts;component/Images/Add_16.png"/>
                    </Button>
                    <Button Style="{StaticResource ActionButtonStyle}" x:Name="Remove" Command="{Binding RemoveCommand}" >
                        <Image Source="/MContracts;component/Images/Delete_16.png"/>
                    </Button>
                    <Button Style="{StaticResource ActionButtonStyle}" x:Name="Flush" Command="{Binding FlushCommand}">
                        <Image Source="/MContracts;component/Images/Trash.png"/>
                    </Button>
                </StackPanel>
            </StackPanel>
            <StackPanel Orientation="Horizontal" >

            <telerik:RadComboBox ItemsSource="{Binding Path=Filterstates, Mode=OneWay, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged}" 
                      SelectedItem="{Binding Path=SelectedFilterstate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True"
                      x:Name="dataGrid" Margin="2" Width="381" 
                      Height="35"/>
            
        </StackPanel>
    </StackPanel>

</UserControl>
